package com.hlt360.benchmark;

public class StopWatch {

    private long timestamp = 0L;

    private long time = 0L;

    private boolean isStarted = false;

    public void start() {
        timestamp = System.currentTimeMillis();
        isStarted = true;
    }

    public void stop() {
        if (isStarted) {
            time += System.currentTimeMillis() - timestamp;
            isStarted = false;
        }
    }

    public long getTime() {
        return time;
    }

}
